<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8"/>
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
		<meta name="HandheldFriendly" content="true"/>
		<link rel="stylesheet" type="text/css" href="css/common.css"/>
		<meta name="MobileOptimized" content="320"/>
		<title>Hello H5+</title>
		<script type="text/javascript" src="js/common.js"></script>
		<script type="text/javascript">
			<script type="text/javascript" charset="utf-8">
      	mui.init();
    </script>
</head>
<body>
	
<div class="dcontent" id="dcontent">
	
<ul class="dlist">
	<li class="ditem" onclick="getVersion()">获取版本信息</li>
	<li class="ditem" onclick="getArgument()"> 获取启动参数</li>
	<li class="ditem" onclick="restartApp()">重启应用</li>
	<li class="ditem" onclick="getAppInfo()">获取应用的信息</li>
	<li class="ditem" onclick="setBadge()">设置角标数字</li>
	<li class="ditem" onclick="clearBadge()">清除角标数字</li>
	<li class="ditem" onclick="exitapp()">退出程序</li>
</ul>	
</div>
<div id="output">
	
</div>
<script src="js/immersed.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">

function clearBardge(){
	plus.runtime.setBadgeNumber(0);
	if(plus.os.name=="iOS"){
		outLine( '如果无法清除提示数字，请到"设置"->"通知"中配置应用在通知中心显示!' );
	}else{
		outLine( "注：仅支持小米(MIUI v5)，其它设备暂不支持此功能!" );
	}
	
}

function setBadge(){
	plus.runtime.setBadgeNumber(99);
	
}

function restartApp(){
	plus.runtime.restart();
}

function getAppInfo(){
	plus.runtime.getProperty( plus.runtime.appid, function ( wgtinfo ) {
		//appid属性
		var wgtStr = "appid:"+wgtinfo.appid;
		//version属性
		wgtStr += "\nversion:"+wgtinfo.version;
		//name属性
		wgtStr += "\nname:"+wgtinfo.name;
		//description属性
		wgtStr += "\ndescription:"+wgtinfo.description;
		//author属性
		wgtStr += "\nauthor:"+wgtinfo.author;
		//email属性
		wgtStr += "\nemail:"+wgtinfo.email;
		//licence属性
		wgtStr += "\nlicense:"+wgtinfo.license;
		//licensehref属性
		wgtStr += "\nlicensehref:"+wgtinfo.licensehref;
		//features 属性
		wgtStr += "\nfeatures:"+wgtinfo.features;
		outSet( wgtStr );
	} );
}

function getArgument(){
	outSet('启动方式---'+plus.runtime.launcher + '启动参数'+ plus.runtime.arguments)
}
	function getVersion(){
		outSet(plus.runtime.version+'\n'+ plus.runtime.innerVersion);
	}
</script>

</body>
</html>